Historical updating oE add, Revision 1
add
include datetime.e namespace datetime public function add(datetime dt, object qty, integer interval)
adds a number of intervals to a datetime.
Parameters:
- dt : the base datetime
- qty : the number of intervals to add. It should be positive.
- interval : which kind of interval to add.
Returns:
A sequence, more precisely a datetime representing the new moment in time.
Comments:
Please see Constants for Date and Time for a reference of valid intervals.
Do not confuse the item access constants (such as YEAR, MONTH, DAY ) with the interval constants (YEARS, MONTHS, DAYS ).
When adding MONTHS, it is a calendar based addition. For instance, a date of 5/2/2008 with 5 MONTHS added will become 10/2/2008. MONTHS does not compute the number of days per each month and the average number of days per month.
When adding YEARS, leap year is taken into account. Adding 4 YEARS to a date may result in a different day of month number due to leap year.
Example 1:
d2 = add(d1, 35, SECONDS) -- add 35 seconds to d1 d2 = add(d1, 7, WEEKS) -- add 7 weeks to d1 d2 = add(d1, 19, YEARS) -- add 19 years to d1
See Also:
Not Categorized, Please Help
|
- diff to current revision, view current revision history, backlinks
- Last modified Sep 04, 2019 by _tom